package com.wwz.swordfingeroffer;

import com.wwz.common.ListNode;

/**
 * 反转链表
 */
public class swordFinger24 {

    public ListNode reverseList(ListNode head) {
        ListNode pre = null;
        ListNode cur = head;
        ListNode next = null;
        while(cur != null){
            next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;

    }
}
